#pragma once

#include <SFML/Graphics.hpp>
#include <iostream>
//#include "Tile.h"
#include "Definition.h"
#include "ImageManager.h"

class BaseOBJ
{
    public:
        BaseOBJ();
        virtual void init(Def def);


        virtual void SetX(int m);
        virtual void SetY(int m);


        virtual int GetX() {return x;};
        virtual int GetY() {return y;};


        virtual void SetDir(int m);
        virtual int GetDir() {return direction;};


        virtual void update(BaseOBJ* surround[3][3]) {/* do nothing for now*/};


        virtual sf::Drawable& getspr() {return draw;};
        virtual bool isAlive() {return alive;};

        virtual void damage(int dmg);

        virtual bool isSolid() {return solid;};

        virtual void SetTag(std::string name, void* data) {mdef.SetVal(name, data);};
        virtual void* GetTag(std::string name) {return mdef.GetVal(name);};

        virtual void SetStr(std::string name, std::string data) {mdef.SetString(name, data);};
        virtual std::string GetStr(std::string name) {return mdef.GetString(name);};


    protected:
        //MUST BE 64X64
        sf::Sprite draw;
        int x;
        int y;
        int hw;
        int hh;
        //0 is up, 1 right, 2 down, 3 left
        int direction;

        bool alive; //Is the object alive? (used in things such as whether to call update or not)
        bool solid;

        Def mdef;
};

